[IA64] Convert some stats to perfc.
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Thu, 3 Aug 2006 17:21:34 +0000 (11:21 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Thu, 3 Aug 2006 17:21:34 +0000 (11:21 -0600)
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
xen/arch/ia64/asm-offsets.c
xen/arch/ia64/xen/domain.c
xen/arch/ia64/xen/faults.c
xen/arch/ia64/xen/hypercall.c
xen/arch/ia64/xen/hyperprivop.S
xen/arch/ia64/xen/privop_stat.c
xen/arch/ia64/xen/vcpu.c
xen/include/asm-ia64/perfc_defn.h
xen/include/asm-ia64/privop_stat.h

index 5cb8fab9ee296377cc90865ce2ecdd65eb6bbede..5f271184ca864d72b025d5340dde0f0773d45fa2 100644 (file)
@@ -211,4 +211,9 @@ void foo(void)
        DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
        DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK]));
 
+#ifdef PERF_COUNTERS
+       BLANK();
+       DEFINE(RECOVER_TO_PAGE_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_page_fault));
+       DEFINE(RECOVER_TO_BREAK_FAULT_PERFC_OFS, offsetof (struct perfcounter, recover_to_break_fault));
+#endif
 }
index a421764c2a38516ca27ff271b7c21d52271d7d6a..95d91c6751eaa8fe8bb5b64beaf83ead614db203 100644 (file)
@@ -136,7 +136,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
     uint64_t pta;
 
     local_irq_save(spsr);
-    context_switch_count++;
+    perfc_incrc(context_switch);
 
     __ia64_save_fpu(prev->arch._thread.fph);
     __ia64_load_fpu(next->arch._thread.fph);
index e370f92fef1cef34b739655f11409162269743e4..7cb8865a79497efbd3e837f06fc8648f9638f45c 100644 (file)
@@ -170,7 +170,7 @@ handle_lazy_cover(struct vcpu *v, struct pt_regs *regs)
                PSCB(v,ifs) = regs->cr_ifs;
                PSCB(v,incomplete_regframe) = 1;
                regs->cr_ifs = 0;
-               lazy_cover_count++;
+               perfc_incrc(lazy_cover);
                return(1); // retry same instruction with cr.ifs off
        }
        return(0);
index e7d5e32f3e6290fefbaec4a7cf6fca10d999005c..f7bc76a27aedce6f14b387c3460324efdcb13c9e 100644 (file)
@@ -210,7 +210,7 @@ fw_hypercall (struct pt_regs *regs)
                if (regs->r28 == PAL_HALT_LIGHT) {
                        if (vcpu_deliverable_interrupts(v) ||
                                event_pending(v)) {
-                                       idle_when_pending++;
+                               perfc_incrc(idle_when_pending);
                                vcpu_pend_unspecified_interrupt(v);
 //printf("idle w/int#%d pending!\n",pi);
 //this shouldn't happen, but it apparently does quite a bit!  so don't
@@ -219,7 +219,7 @@ fw_hypercall (struct pt_regs *regs)
 //as deliver_pending_interrupt is called on the way out and will deliver it
                        }
                        else {
-                               pal_halt_light_count++;
+                               perfc_incrc(pal_halt_light);
                                do_sched_op_compat(SCHEDOP_yield, 0);
                        }
                        regs->r8 = 0;
index 5a2e2889943521bf23a99093acec8baf70a53cd6..7c977c52b8f6754a967d728870607064be202f4d 100644 (file)
@@ -977,8 +977,8 @@ END(fast_tlb_miss_reflect)
 
 // we get here if fast_insert fails (e.g. due to metaphysical lookup)
 ENTRY(recover_and_page_fault)
-#ifdef FAST_REFLECT_CNT
-       movl r21=recover_to_page_fault_count;;
+#ifdef PERF_COUNTERS
+       movl r21=perfcounters + RECOVER_TO_PAGE_FAULT_PERFC_OFS;;
        ld8 r22=[r21];;
        adds r22=1,r22;;
        st8 [r21]=r22;;
@@ -2009,8 +2009,8 @@ END(hyper_ptc_ga)
 
 // recovery block for hyper_itc metaphysical memory lookup
 ENTRY(recover_and_dispatch_break_fault)
-#ifdef FAST_REFLECT_CNT
-       movl r21=recover_to_break_fault_count;;
+#ifdef PERF_COUNTERS
+       movl r21=perfcounters + RECOVER_TO_BREAK_FAULT_PERFC_OFS;;
        ld8 r22=[r21];;
        adds r22=1,r22;;
        st8 [r21]=r22;;
index b6fe406fad3beb5f033f30e2a9116c412c11005e..eff99f72d73893fb71a6ba6c1991f161c9088945 100644 (file)
@@ -3,18 +3,6 @@
 #include <xen/lib.h>
 #include <asm/uaccess.h>
 
-unsigned long dtlb_translate_count = 0;
-unsigned long tr_translate_count = 0;
-unsigned long phys_translate_count = 0;
-unsigned long vhpt_translate_count = 0;
-unsigned long fast_vhpt_translate_count = 0;
-unsigned long recover_to_page_fault_count = 0;
-unsigned long recover_to_break_fault_count = 0;
-unsigned long idle_when_pending = 0;
-unsigned long pal_halt_light_count = 0;
-unsigned long context_switch_count = 0;
-unsigned long lazy_cover_count = 0;
-
 unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
 unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1] = { 0 };
 
@@ -235,38 +223,6 @@ static int zero_privop_counts(char *buf)
        return s - buf;
 }
 
-static int dump_misc_stats(char *buf)
-{
-       char *s = buf;
-       s += sprintf(s,"Virtual TR translations: %ld\n",tr_translate_count);
-       s += sprintf(s,"Virtual VHPT slow translations: %ld\n",vhpt_translate_count);
-       s += sprintf(s,"Virtual VHPT fast translations: %ld\n",fast_vhpt_translate_count);
-       s += sprintf(s,"Virtual DTLB translations: %ld\n",dtlb_translate_count);
-       s += sprintf(s,"Physical translations: %ld\n",phys_translate_count);
-       s += sprintf(s,"Recoveries to page fault: %ld\n",recover_to_page_fault_count);
-       s += sprintf(s,"Recoveries to break fault: %ld\n",recover_to_break_fault_count);
-       s += sprintf(s,"Idle when pending: %ld\n",idle_when_pending);
-       s += sprintf(s,"PAL_HALT_LIGHT (no pending): %ld\n",pal_halt_light_count);
-       s += sprintf(s,"context switches: %ld\n",context_switch_count);
-       s += sprintf(s,"Lazy covers: %ld\n",lazy_cover_count);
-       return s - buf;
-}
-
-static void zero_misc_stats(void)
-{
-       dtlb_translate_count = 0;
-       tr_translate_count = 0;
-       phys_translate_count = 0;
-       vhpt_translate_count = 0;
-       fast_vhpt_translate_count = 0;
-       recover_to_page_fault_count = 0;
-       recover_to_break_fault_count = 0;
-       lazy_cover_count = 0;
-       pal_halt_light_count = 0;
-       idle_when_pending = 0;
-       context_switch_count = 0;
-}
-
 static const char * const hyperpriv_str[HYPERPRIVOP_MAX+1] = {
        0, "rfi", "rsm.dt", "ssm.dt", "cover", "itc.d", "itc.i", "ssm.i",
        "=ivr", "=tpr", "tpr=", "eoi", "itm=", "thash", "ptc.ga", "itr.d",
@@ -360,7 +316,6 @@ int dump_privop_counts_to_user(char __user *ubuf, int len)
        n += dump_privop_addrs(buf + n);
 #endif
        n += dump_vhpt_stats(buf + n);
-       n += dump_misc_stats(buf + n);
        if (__copy_to_user(ubuf,buf,n))
                return -1;
        return n;
@@ -381,7 +336,6 @@ int zero_privop_counts_to_user(char __user *ubuf, int len)
        zero_privop_addrs();
 #endif
        zero_vhpt_stats();
-       zero_misc_stats();
        zero_reflect_counts();
        if (__copy_to_user(ubuf,buf,n))
                return -1;
index fbbfc5e47491696ce14f375c387cf69bda3efb4b..7b13d68556bb73d46f1d500e6a94e5a0cd528d58 100644 (file)
@@ -1500,7 +1500,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt
                        *pteval = (address & _PAGE_PPN_MASK) | __DIRTY_BITS |
                                  _PAGE_PL_2 | _PAGE_AR_RWX;
                        *itir = PAGE_SHIFT << 2;
-                       phys_translate_count++;
+                       perfc_incrc(phys_translate);
                        return IA64_NO_FAULT;
                }
        }
@@ -1521,7 +1521,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt
                if (trp != NULL) {
                        *pteval = trp->pte.val;
                        *itir = trp->itir;
-                       tr_translate_count++;
+                       perfc_incrc(tr_translate);
                        return IA64_NO_FAULT;
                }
        }
@@ -1531,7 +1531,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt
                if (trp != NULL) {
                        *pteval = trp->pte.val;
                        *itir = trp->itir;
-                       tr_translate_count++;
+                       perfc_incrc(tr_translate);
                        return IA64_NO_FAULT;
                }
        }
@@ -1544,7 +1544,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt
            && vcpu_match_tr_entry_no_p(trp,address,rid)) {
                *pteval = pte.val;
                *itir = trp->itir;
-               dtlb_translate_count++;
+               perfc_incrc(dtlb_translate);
                return IA64_USE_TLB;
        }
 
@@ -1582,7 +1582,7 @@ IA64FAULT vcpu_translate(VCPU *vcpu, UINT64 address, BOOLEAN is_data, UINT64 *pt
        /* found mapping in guest VHPT! */
        *itir = rr & RR_PS_MASK;
        *pteval = pte.val;
-       vhpt_translate_count++;
+       perfc_incrc(vhpt_translate);
        return IA64_NO_FAULT;
 }
 
index 112214236f9cf7e6934e7d9e7c84b442b4b0106e..32532dd143cb28688c5d90934f7a228e17c6b3ba 100644 (file)
@@ -1 +1,24 @@
-/* This file is empty.  */
+#ifndef XEN_PERFC_DEFN_H
+#define XEN_PERFC_DEFN_H
+
+PERFCOUNTER_CPU(dtlb_translate,                "dtlb hit")
+
+PERFCOUNTER_CPU(tr_translate,          "TR hit")
+
+PERFCOUNTER_CPU(vhpt_translate,                "virtual vhpt translation")
+PERFCOUNTER_CPU(fast_vhpt_translate,   "virtual vhpt fast translation")
+
+PERFCOUNTER(recover_to_page_fault,     "recoveries to page fault")
+PERFCOUNTER(recover_to_break_fault,    "recoveries to break fault")
+
+PERFCOUNTER_CPU(phys_translate,                "metaphysical translation")
+
+PERFCOUNTER_CPU(idle_when_pending,     "vcpu idle at event")
+
+PERFCOUNTER_CPU(pal_halt_light,                "calls to pal_halt_light")
+
+PERFCOUNTER_CPU(context_switch,                "context switch")
+
+PERFCOUNTER_CPU(lazy_cover,            "lazy cover")
+
+#endif
index 92e445da3e54d0ce45aa3427f26457bc30f4adc4..bb796eee9098f902c943b04f83204f09a41ba471 100644 (file)
@@ -7,24 +7,6 @@ extern int zero_privop_counts_to_user(char *, int);
 
 #define PRIVOP_ADDR_COUNT
 
-/* vcpu_translate hit with dtlb.  */
-extern unsigned long dtlb_translate_count;
-
-/* vcpu_translate hit with tr.  */
-extern unsigned long tr_translate_count;
-
-/* vcpu_translate in metaphysical mode.  */
-extern unsigned long phys_translate_count;
-
-extern unsigned long vhpt_translate_count;
-extern unsigned long fast_vhpt_translate_count;
-extern unsigned long recover_to_page_fault_count;
-extern unsigned long recover_to_break_fault_count;
-extern unsigned long idle_when_pending;
-extern unsigned long pal_halt_light_count;
-extern unsigned long context_switch_count;
-extern unsigned long lazy_cover_count;
-
 extern unsigned long slow_hyperpriv_cnt[HYPERPRIVOP_MAX+1];
 extern unsigned long fast_hyperpriv_cnt[HYPERPRIVOP_MAX+1];